package com.miku.blog.controller;

import com.miku.blog.annotation.SystemLog;
import com.miku.blog.domain.UserAuth;
import com.miku.blog.domain.dto.UserAuthDTO;
import com.miku.blog.domain.param.ReceptionParam;
import com.miku.blog.domain.pojo.ResponseResult;
import com.miku.blog.service.UserAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author shkstart
 * @create ${}YEAR-06-17 2:58
 */
@Api(tags = "Blog{用户}")
@RestController
public class UserAuthController {

    @Autowired
    private UserAuthService userAuthService;


    @SystemLog(notes = "更新用户邮箱")
    @ApiOperation(value = "更新用户邮箱接口")
    @PostMapping("/users/email")
    public ResponseResult updateEmail(@RequestBody UserAuthDTO userAuthDTO){
        return userAuthService.updateEmail(userAuthDTO);
    }


    @SystemLog(notes = "更新用户密码")
    @ApiOperation(value = "更新用户密码接口")
    @PutMapping("/users/password")
    public ResponseResult updatePassword(@RequestBody UserAuthDTO userAuthDTO){
        return userAuthService.updatePassword(userAuthDTO);
    }


    @SystemLog(notes = "注册")
    @ApiOperation(value = "注册接口")
    @PostMapping("/register")
    public ResponseResult register(@RequestBody UserAuthDTO userAuthDTO){
        return userAuthService.register(userAuthDTO);
    }


}
